import request from '@/utils/request'

export default {

  fetchSectionTree() {
    return request({
      url: process.env.VUE_APP_COURSE_BASE_URL + '/section/show',
      method: 'get'

    })
  },

  saveSectionTree (sectionTree) {
    return request({
      url: process.env.VUE_APP_COURSE_BASE_URL + '/section/update',
      method: 'post',
      data: sectionTree
    })
  },
  saveSectionContent (sectionList) {
    return request({
      url: process.env.VUE_APP_COURSE_BASE_URL + '/section/updatecontent',
      method: 'post',
      data: sectionList
    })
  },
  unbondSectionMaterial (data) {
    return request({
      url: process.env.VUE_APP_COURSE_BASE_URL + '/section/unbondSectionMaterial',
      method: 'post',
      data: data
    })
  },
  bondSectionMaterial (data) {
    return request({
      url: process.env.VUE_APP_COURSE_BASE_URL + '/section/bondSectionMaterial',
      method: 'post',
      data: data
    })
  },
  listSectionMaterial (params) {
    return request({
      url: process.env.VUE_APP_COURSE_BASE_URL + '/section/listSectionMaterial',
      method: 'get',
      params: params
    })
  },

  listAllTalk (sectionId) {
    return request({
      url: process.env.VUE_APP_COURSE_BASE_URL + '/section/talk',
      method: 'get',
      params: {sectionId: sectionId}
    })
  },
  fireTalk(content, sectionId) {
    return request({
      url: process.env.VUE_APP_COURSE_BASE_URL + '/section/addtalk',
      method: 'post',
      data: {sectionId:sectionId,courseTalkTitle: "话题" + Date.now() ,courseTalkContent: content }
    })
  },
  savegreat(courseTalkId) {
    return request({
      url: process.env.VUE_APP_COURSE_BASE_URL + '/section/savegreat',
      method: 'post',
      params: {courseTalkId: courseTalkId }
    })
  },

  dissTalk(courseTalkNumber, content, sectionId) {
    return request({
      url: process.env.VUE_APP_COURSE_BASE_URL + '/section/replytalk',
      method: 'post',
      data: {courseTalkNumber: courseTalkNumber,sectionId: sectionId, courseTalkContent: content, courseTalkTitle:''}
    })
  },
  addTopNode(nodeName) {
    return request({
      url: process.env.VUE_APP_COURSE_BASE_URL + '/section/node',
      method: 'post',
      data: {nodeName: nodeName}
    })
  },
}
